<template>
<view>
<view class="container">
    <view class="nav">
        <navigator :class="'nav-item ' + (requestUrl == requestData.orderby_default ? 'red-on' : '')" @tap="changeTab" :data-href="requestData.orderby_default">综合<view class="ico-dg"><image class="wh100" src="/static/images/dg.png"></image></view></navigator>
        <navigator :class="'nav-item ' + (requestUrl == requestData.orderby_sales_sum ? 'red-on' : '')" @tap="changeTab" :data-href="requestData.orderby_sales_sum">销量</navigator>
        <navigator :class="'nav-item ' + (requestData.sort!='shop_price' ? '' : 'red-on')" @tap="changeTab" :data-href="requestData.orderby_price">价格<view :class="'ico-dir ' + (requestData.sort!='shop_price'?'':(requestData.sort_asc=='asc'?'ico-dir-up':'ico-dir-dn'))" :style="'background-image: url(' + (resourceUrl+'/static/images/sxjt.png') + ');'"></view></navigator>
        <navigator class="nav-item" @tap="changeTab">筛选<view class="ico-filter"><image class="wh100" src="/static/images/xx.png"></image></view></navigator>
        <navigator class="nav-item nav-search" @tap="openSearchModalFun"><image class="wh100 search-img" src="/static/images/search.png"></image></navigator>
    </view>

    <view class="choice_list">
        <block v-for="(item, index) in requestData.goods_list" :key="index">
            <navigator class="choice_item" :url="'/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id">
                <view class="img-wrap">
                <view class="h-label" v-if="item.label_name" style="background: url(/images/h-label.png) no-repeat;background-size:90rpx 24rpx;">{{item.label_name}}</view>

                    <image :src="url + '/api/goods/goodsThumImages?goods_id=' + item.goods_id + '&width=400&height=400'"></image>
                </view>
                <view class="item-cont">
                    <view class="title">{{item.goods_name}}</view>
                    <view>
                      <view class="smj">¥</view>
                      <view class="price">{{item.shop_price[0]}}.</view>
                      <view class="smj">{{item.shop_price[1]}}</view>
                    </view>
                    <!-- <view class="comment">已售出{{ item.sales_sum }}件</view> -->
                    <view class="carts" v-if="is_on" @tap.stop="openSpecModel" :data-goods_id="item.goods_id">
                      <image src="/static/images/shopc.png" style="width:45rpx;height:45rpx;position:absolute;right:0;bottom:15rpx;"></image>
                    </view> 
                    
                </view>
            </navigator>
        </block>
    </view>

    <view class="no-data" v-if="!requestData.goods_list || requestData.goods_list.length == 0">
        <image src="/static/images/cart-null.png" class="cart-image"></image>
        <view class="no-data-title">没有相关的数据</view>
        <navigator url="/pages/index/index/index" class="lookat"> 去逛逛 </navigator>
    </view>
</view>

<!-- 筛选弹框  -->
<view :hidden="!openFilterModal">
    <view class="cover-layer" @tap="closeFilterModal"></view>
          <!-- 新的筛选页面 -->
        <view class="filter-modal">
                <view class="title">筛选</view>
                <!-- <view class='choose'>
                    <text bindtap='change1' data-index='{{index}}' class='{{flag==index?"select":""}}' wx:for="{{filtrate}}">{{item}}</text>
                </view> -->
                <view class="bac"></view>
                <view class="money">
                    <view class="tit">价格</view>
                    <view class="choose">
                        <block v-for="(item, index) in requestData.filter_price" :key="index"> 
                            <text :class="flag1==index?'select':''" @tap="change" :data-href="item.href" :data-index1="index">{{item.name}}</text>                
                        </block>
                        
                        <view>
                            <input placeholder-class="placeholder" type="number" @input="minFun" placeholder="最低价" auto-focus></input>
                            <text>-</text>
                            <input placeholder-class="placeholder" type="number" @input="maxFun" placeholder="最高价"></input>
                        </view>
                    </view>
                </view>
                <view class="bottom">
                    <text @tap="reset">重置</text>
                    <text @tap="closeFilterModal">确定</text>
                </view>
        </view>
    <!-- 旧的筛选页面 -->
    <!-- <view class="filter-modal">
        <icon type="cancel" color="gray" size="22" class="modal-close" bindtap="closeFilterModal"/>
        <button class="viewall-btn" bindtap="restoreData">显示全部分类</button>
         <view class="filter-box" wx:if="{{requestData.filter_menu.length >0}}">当前选中</view>
         <view class="filter-items" wx:for="{{requestData.filter_menu}}" catchtap="filterGoods" data-href="{{item.href}}"  ><view class="filter-item"  style="background-color:#ff6a00;color:#fff;margin:10rpx">{{item.name}}</view></view>
        <view class="filter-box" wx:for="{{requestData.filter_spec}}" wx:key="{{index}}">
            <view class="filter-name">{{item.name}}</view>
            <view class="filter-items">
                <view class="filter-item" wx:for="{{item.item}}" wx:key="{{index}}" data-href="{{item.href}}" bindtap="filterGoods">
                {{item.name}}</view>
            </view>
        </view>
        <view class="filter-box" wx:for="{{requestData.filter_attr}}" wx:key="{{index}}">
            <view class="filter-name">{{item.name}}</view>
            <view class="filter-items">
                <view class="filter-item" wx:for="{{item.item}}" wx:key="{{index}}" data-href="{{item.href}}" bindtap="filterGoods">
                {{item.name}}</view>
            </view>
        </view>
        <view class="filter-box" wx:if="{{requestData.filter_brand.length>0}}">
            <view class="filter-name">相关品牌</view>
            <view class="filter-items">
                <view class="filter-item" wx:for="{{requestData.filter_brand}}" wx:key="{{index}}" data-href="{{item.href}}" bindtap="filterGoods">
                {{item.name}}</view>
            </view>
        </view>
        <view class="filter-box" wx:if="{{requestData.filter_price.length>0}}">
            <view class="filter-name">价格区间</view>
            <view class="filter-items">
                <view class="filter-item" wx:for="{{requestData.filter_price}}" wx:key="{{index}}" data-href="{{item.href}}" bindtap="filterGoods">
                {{item.name}}</view>
            </view>
        </view>
    </view> -->
</view>

<!-- 搜索弹框 -->
<view v-if="openSearchModal">
    <view class="search-modal">
        <view class="search-bar">
        <view class="fdj"><image src="/static/images/search.png"></image></view>
            <form @submit="submitSearch">
                <input class="search-input" placeholder="输入你想搜索的内容..." name="word" auto-focus></input>
                <button class="search-btn" form-type="submit">
                搜索
                </button>
            </form>
        </view>
        <view class="search-hot">
            <view class="hot-title">热搜</view>
            <block v-for="(item, index) in hotWords" :key="index">
                <view class="hot-row">
                    <view v-for="(item, index2) in item" :key="index2" class="hot-item" @tap="searchHotWord" :data-word="item">{{item}}</view>
                </view>
            </block>
        </view>

         <view class="search-hot">
            <view class="hot-title">历史搜索</view>
            <block v-if="historyList.length > 0" :key="index">
                <view class="historyList">
                    <view v-for="(item, index) in historyList" :key="index" class="historyList-item" @tap="searchHotWord" :data-word="item"><text class="word">{{item}}</text>
                    <text :data-index="index" class="del" @tap.stop="clear">删除</text>
                    </view>
                </view>
            </block>
        </view>
         <!-- <view class="text-center">
            <view class="clear" wx:if="{{historyList.length > 0}}"  catchtap='clear'>清空搜索历史</view>
         </view> -->
    </view>
   
</view>

<!-- 规格弹窗 -->
<view :hidden="!openSpecModal">
    <view class="cover-layer" @tap="closeSpecModal"></view>
    <view class="spec-model">
        <icon type="cancel" color="gray" size="22" class="modal-close" @tap="closeSpecModal"></icon>
        <view class="spec-goods">
            <image class="wh100 spec-img" :src="url + '/api/goods/goodsThumImages?goods_id=' + data.goods.goods_id + '&width=200&height=200'"></image>
            <view class="spec-goods-info">
                <view class="spec-goods-name">{{data.goods.goods_name}}</view>
                  <view class="prom-info" v-if="select.activity.prom_type && select.activity.prom_type != 6">
                    <text class="prom-type">{{select.activity.countName}}</text>
                    <text>{{select.activity.countTime}}</text>
                </view>
                 <navigator class="prom-info" v-if="select.activity.prom_type == 6" :url="'../../team/team_info/team_info?goods_id=' + select.activity.goods_id + '&team_id=' + select.activity.team_id + '&item_id=' + select.activity.item_id">
                    <text class="prom-type">{{select.activity.countName}}</text>
                    <view style="display:inline-block;" class="click-go">点击前往</view>
                </navigator>
                <view class="spec-goods-price">{{select.activity.priceName?select.activity.priceName:''}}￥ {{select.price[0]}}.{{select.price[1]}}
                </view>
                <view class="spec-goods-stock">剩余库存：{{select.stock}}</view>
            </view>
        </view>
        <block v-for="(item, listIdx) in data.goods_spec_list" :key="listIdx">
            <view class="spec-name">规格</view>
            <view class="spec_types">
            <view v-for="(spec, index) in item.spec_item" :key="index" :class="'spec-btn ' + (item.selectItemId==spec.id?'spec-btn-click':'')" @tap="selectSpec" :data-listidx="listIdx" :data-itemid="spec.id">{{spec.item}}</view>
            </view>
        </block>
        <view class="spec-box">
          <view class="spec-name">数量</view>
          <view class="count">
              <view class="sub" @tap="subCartNum">-</view>
              <input type="number" :value="goodsInputNum" @blur="inputCartNum"></input>
              <view class="add" @tap="addCartNum">+</view>
          </view>
        </view>
        <view class="spec-cart-btns">
                <view v-if="data.goods.is_virtual" :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="buy" @tap="addCart">立即购买</view>
            <block v-else-if="select.activity.prom_type == 8">                
                        <view :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" @tap="bargainBuy" data-action="add" :data-status="isSeparate">{{isSeparate?'砍价拿':'加入购物车'}}</view>                   
            </block>
                 <view v-else-if="select.activity.prom_type == 4" :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="reserve" @tap="addCart">立即预订</view>
           
            <block v-else-if="data.goods.exchange_integral <= 0">
                <!-- <view class="spec-cart-btn spec-add-cart {{select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':''}}" data-action='add' bindtap="addCart">加入购物车</view> -->
                <view :class="'spec-cart-btn spec-buy ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="buy" @tap="addCart">确定</view>
            </block>
            <view v-else :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="exchange" @tap="addCart">立即兑换</view>
        </view>
    </view>
</view>
</view>
</template>

<script>
var app = getApp();
var common = require("../../../utils/common.js");
const request = require("../../../utils/request.js");
const util = require("../../../utils/util.js");
import LoadMore from "../../../utils/LoadMore";
var load = new LoadMore();

export default {
  data() {
    return {
      url: app.globalData.setting.url,
      resourceUrl: app.globalData.setting.resourceUrl,
      currentPage: 1,
      requestData: null,
      //请求的数据
      allData: null,
      //第一次请求到的所有数据，用于恢复筛选数据
      openFilterModal: false,
      //打开筛选弹框
      openSearchModal: false,
      //打开搜索界面
      baseUrl: '/api/goods/search',
      //基地址
      requestUrl: '',
      //请求的链接
      hotWords: [['手机', '小米', 'iphone'], ['三星', '华为', '冰箱']],
      //搜索热词
      filtrate: ['显示全部', '仅看包邮', '仅看有货', '促销商品'],
      //筛选
      flag: 0,
      flag1: 4,
      specSelect: 0,
      //选中的组合规格数组spec_goods_price下标
      optionItemId: 0,
      //页面参数，页面初始化指定显示的itemid，用于活动
      shippingCost: 0,
      hasSpec: true,
      openSpecModal: false,
      //是否打开规格弹窗
      is_on: true,
      // 是否打开快速下单入口
      select: {
        //选择的(规格)商品的参数，用于显示
        price: 0,
        stock: 0,
        specName: '',
        activity: null
      },
      is_on: true,
      // 是否打开快速下单入口
      isBragain: false,
      isSeparate: true,
      goodsInputNum: 1,
      //选中的商品件数
      href: '',
      //价格选择
      min: "",
      //最低价
      max: "",
      //最高价
      word: "" //搜索词
      ,
      selecteds: [],
      historyList: "",
      enterAddressPage: false,
      data: ""
    };
  },

  components: {},
  props: {},
  onLoad: function (options) {
    //获取全部分类
    this.restoreData();
    var hot_keywords = common.getConfigByName(app.globalData.config['config'], 'hot_keywords');

    if (hot_keywords && hot_keywords.indexOf("|") != -1) {
      var data = hot_keywords.split('|');
      var arrs = [];
      var arr1 = [];
      var arr2 = [];

      for (let i = 0; i < data.length; i++) {
        if (i >= 0 && i < 4) {
          arr1.push(data[i]);
        } else if (i >= 4 && i < 8) {
          arr2.push(data[i]);
        }
      }

      arrs.push(arr1);
      arrs.push(arr2);
      this.setData({
        hotWords: arrs
      });
    }

    load.init(this, 'goods_list', 'requestData');

    if (typeof options.brand_id != 'undefined') {
      return this.requestSearch(this.baseUrl + '?brand_id=' + options.brand_id);
    }

    this.openSearchModalFun();
  },
  onReachBottom: function () {
    if (this.openSearchModal) {
      return;
    }

    if (load.canloadMore()) {
      this.requestSearch(this.requestUrl);
    }
  },

  onShow() {
    this.getHistory();
  },

  onPullDownRefresh: function () {
    this.resetData();
    this.requestGoodsList(this.requestUrl);
  },
  methods: {
    changeTab: function (e) {
      this.resetData();
      this.requestSearch(e.currentTarget.dataset.href);
    },
    requestSearch: function (requestUrl, str) {
      var that = this;
      this.requestUrl = requestUrl; //保存链接

      this.setData({
        requestUrl: requestUrl
      });
      console.log(this.requestUrl);
      requestUrl += (requestUrl.indexOf('?') > 0 ? '&' : '?') + 'p=' + that.currentPage;
      load.request(requestUrl, function (res) {
        if (!res.data.result.goods_list) {
          uni.showToast({
            title: '未找到相关商品',
            icon: 'none',
            duration: 1500
          });
          return;
        }

        var j = 0;

        for (var i of res.data.result.goods_list) {
          res.data.result.goods_list[j].shop_price = parseFloat(i.shop_price).toFixed(2).toString().split('.');
          j++;
        }

        that.currentPage++;

        if (that.allData == null) {
          that.allData = Object.assign({}, res.data.result);
        }

        that.setHistory(str);
        that.closeSearchModal();
      });
    },
    //筛选最低价
    minFun: function (e) {
      var min = e.detail.value;
      this.setData({
        min: min
      });
    },
    //筛选最高价
    maxFun: function (e) {
      var max = e.detail.value;
      this.setData({
        max: max
      });
    },
    // 打开筛选
    openFilterModalFun: function () {
      this.setData({
        openFilterModal: true
      });
      this.restoreData();
    },
    // 确定筛选
    closeFilterModal: function () {
      this.setData({
        openFilterModal: false
      }); //商品筛选

      this.resetData(); // 是否有输入最低，最高价

      if (this.min != '' && this.max != '') {
        this.requestSearch('/api/Goods/search/id/0/q/' + this.word + '/' + 'price/' + this.min + '-' + this.max);
      } else {
        this.requestSearch(this.href);
      }
    },

    /** 商品筛选 */
    filterGoods: function (e) {
      this.requestSearch(e.currentTarget.dataset.href);
      this.closeFilterModal();
    },

    /** 重置数据 */
    resetData: function () {
      load.resetConfig();
      this.requestData = null;
      this.currentPage = 1;
    },
    restoreData: function () {
      this.setData({
        'requestData': this.allData,
        selecteds: []
      });
    },
    openSearchModalFun: function () {
      this.setData({
        openSearchModal: true
      });
    },
    closeSearchModal: function () {
      this.setData({
        openSearchModal: false
      });
    },

    /** 提交搜索事件 */
    submitSearch: function (e) {
      this.search(e.detail.value.word);
    },

    /** 点击搜索热词事件 */
    searchHotWord: function (e) {
      this.search(e.currentTarget.dataset.word);
    },

    /** 对搜索词进行搜索 */
    search: function (word) {
      if (typeof word != 'string' || common.isNull(word)) {
        return app.globalData.showTextWarining('请输入搜索关键词');
      }

      app.globalData.showLoading();
      this.resetData();
      this.requestSearch(this.baseUrl + '?q=' + word, word);
      this.setData({
        word: word
      });
    },

    /** 对搜索词添加到历史搜索 */
    setHistory: function (word) {
      console.log(word);

      if (word == 'null' || typeof word == 'object') {
        return;
      }

      var that = this;
      uni.getStorage({
        key: 'search_history',
        success: function (res) {
          var arr = [];

          if (res.data.indexOf(word) > 0) {
            var index = res.data.indexOf(word);
            res.data.splice(index, 1);
            arr.push(word);

            for (var i = 0; i < res.data.length; i++) {
              arr.push(res.data[i]);
            }
          }

          if (arr.length > 0) {
            var arrs = arr;
          } else {
            let newData = new Set([...Array.of(word), ...res.data]);
            var arrs = [...newData];
          }

          if (arrs.length == 8) {
            arrs.pop();
          }

          uni.setStorage({
            key: "search_history",
            data: arrs
          });
          that.setData({
            historyList: arrs
          });
        },
        fail: function (res) {
          uni.setStorage({
            key: "search_history",
            data: Array.of(word)
          });
          that.setData({
            historyList: Array.of(word)
          });
        }
      });
    },

    /** 清空全部历史搜索 */
    // clear:function(){
    //     var that = this ;
    //     wx.removeStorage({
    //         key: 'search_history',
    //         success: function(res) {
    //             that.setData({
    //                 historyList: []
    //             })
    //         },
    //     })
    // },

    /** 清空对应历史搜索 */
    clear: function (e) {
      var that = this;
      var historyList = uni.getStorageSync('search_history');
      historyList.splice(e.currentTarget.dataset.index, 1);
      uni.setStorage({
        key: "search_history",
        data: historyList
      });
      that.setData({
        historyList: historyList
      });
    },

    /** 获取历史搜索 */
    getHistory: function () {
      var that = this;
      uni.getStorage({
        key: 'search_history',
        success: function (res) {
          if (res.data.indexOf('null')) {
            res.data = res.data.filter(function (s) {
              return s && s.trim();
            });
            uni.setStorageSync('search_history', res.data);
          }

          that.setData({
            historyList: res.data
          });
        }
      });
    },

    /**-------------- 快速下单开始 --------------------*/

    /** 购买虚拟商品 */
    buyVirtualGoods: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      Object.assign(data, {
        goods_name: this.data.goods.goods_name,
        spec_name: this.select.specName,
        price: this.select.price
      });
      uni.navigateTo({
        url: '/pages/virtual/buy_step/buy_step?' + util.Obj2Str(data)
      });
    },

    /** 立即兑换 */
    exchange: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      if (app.globalData.userInfo.pay_points < this.data.goods.exchange_integral) {
        return app.globalData.showTextWarining('您的积分不够喔~');
      }

      if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
        return;
      }

      this.setData({
        openSpecModal: false,
        enterAddressPage: true
      });
      uni.navigateTo({
        url: '/pages/cart/integral/integral?' + util.Obj2Str(data)
      });
    },

    /** 立即预订 */
    reserve: function (data) {
      var that = this; //检查用户是否登录方可操作立即购买

      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
        return;
      }

      Object.assign(data, {
        action: 'reserve',
        prom_id: that.select.activity.prom_id ? that.select.activity.prom_id : ''
      });
      this.setData({
        openSpecModal: false,
        enterAddressPage: true
      });
      uni.navigateTo({
        url: '/pages/cart/reserve/reserve?' + util.Obj2Str(data)
      });
    },

    /** 立即购买 */
    buyNow: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
        return;
      }

      Object.assign(data, {
        action: 'buy_now'
      });
      this.setData({
        openSpecModal: false
      });
      uni.navigateTo({
        url: '/pages/cart/cart2/cart2?' + util.Obj2Str(data)
      });
    },

    /** 关闭规格弹窗 */
    closeSpecModal: function () {
      this.setData({
        openSpecModal: false
      });
    },

    /** 打开规格弹窗 */
    openSpecModel: function (e) {
      var that = this;
      request.get('/api/goods/goodsInfo', {
        data: {
          id: e.currentTarget.dataset.goods_id
        },
        failRollback: true,
        success: function (res) {
          that.setData({
            data: res.data.result,
            openSpecModal: true,
            isSeparate: true
          });
          that.initData(res.data.result);
        }
      });
    },

    /** 初始化数据，注意顺序 */
    initData: function (data) {
      //检查商品
      this.initCheckGoods(data); //检查一下购物的数量，可能无库存

      this.checkCartNum(this.goodsInputNum);
    },

    /** 检查商品 */
    initCheckGoods: function (data) {
      var that = this;
      request.post('/api/goods/activity', {
        data: {
          goods_id: data.goods.goods_id,
          item_id: data.goods.spec_goods_price.length > 0 ? data.goods.spec_goods_price[0]['item_id'] : ''
        },
        success: function (res) {
          //初始化规格
          if (res.data.result.goods.activity_is_on == 1) {
            that.initSpecsPrice(res.data.result);
          } else {
            data.goods.prom_type = 0;
            that.initSpecsPrice(data);
          }
        }
      });
    },

    /** 初始化所有规格 */
    initSpecsPrice: function (data) {
      var specSelect = 0; //初始化选中第一个规格 

      var specs = this.data.goods.spec_goods_price;

      if (specs.length == 0) {
        //没有规格
        this.initActivity(data.goods);
        return;
      } //第一次请求的总数据中的activity默认是第一种规格的,可减少一次请求
      //specs[0].activity = data.goods;


      if (this.optionItemId) {
        //指定规格
        for (var i = 0; i < specs.length; i++) {
          if (specs[i].item_id == this.optionItemId) {
            specSelect = i;
            break;
          }
        }
      } else {
        //初始化选库存不为0的规格
        for (var i = 0; i < specs.length; i++) {
          if (specs[i].store_count <= 0) {
            continue;
          }

          specSelect = i;
          break;
        }
      }

      specs[specSelect].activity = data.goods; //生成子规格组(goods_spec_list)的各自选中项

      var specIds = specs[specSelect].key.split("_");
      var list = this.data.goods.spec;

      for (var i = 0; i < list.length; i++) {
        for (var j = 0; j < list[i].spec_item.length; j++) {
          if (util.inArray(list[i].spec_item[j].id, specIds)) {
            list[i].selectItemId = list[i].spec_item[j].id;
            break;
          }
        }
      }

      this.setData({
        specSelect: specSelect,
        'data.goods_spec_list': list,
        'data.goods.spec_goods_price': specs
      });
      this.initSelectSpecGoods();
    },

    /** 初始化选中的规格商品 */
    initSelectSpecGoods: function () {
      var specSelect = this.specSelect;
      var specs = this.data.goods.spec_goods_price;
      var itemId = specs[specSelect].item_id;

      if (specs[specSelect].prom_type == 0) {
        var noActivity = {
          prom_type: 0
        };
        specs[specSelect].activity = noActivity;
        this.initActivity(noActivity);
      } else if (typeof specs[specSelect].activity != 'undefined') {
        this.initActivity(specs[specSelect].activity);
      } else {
        this.requestSpecInfo(specSelect);
      }
    },

    /** 点击规格按钮的回调函数 */
    selectSpec: function (e) {
      //对商品数量进行判断，对库存进行判断
      var itemId = e.currentTarget.dataset.itemid;
      var listIdx = e.currentTarget.dataset.listidx;
      var list = this.data.goods_spec_list;

      if (list[listIdx].selectItemId == itemId) {
        return;
      }

      list[listIdx].selectItemId = itemId;
      var newSpecKeys = [];

      for (var i = 0; i < list.length; i++) {
        newSpecKeys[i] = list[i].selectItemId;
      } //item排序,生成key


      var newSpecKeys = util.sortSize(newSpecKeys).join('_');
      var newSpecSelect = 0;
      var specs = this.data.goods.spec_goods_price;
      var hasSpec = false;

      for (var i = 0; i < specs.length; i++) {
        if (specs[i].key == newSpecKeys) {
          hasSpec = true;
          newSpecSelect = i;
          break;
        }
      }

      this.setData({
        hasSpec: hasSpec,
        specSelect: newSpecSelect,
        'data.goods_spec_list': list,
        isBragain: this.isSeparate ? false : true
      });
      this.initSelectSpecGoods();
      this.checkCartNum(this.goodsInputNum);
    },

    /** 初始化显示的活动信息 */
    initActivity: function (activity) {
      if (activity.prom_type && activity.prom_type != 6) {
        var startTime = new Date().getTime();

        if (activity.prom_type == 1) {
          //抢购
          activity.priceName = '抢购价';
          activity.countName = '限时抢购';
        } else if (activity.prom_type == 2) {
          //团购
          activity.priceName = '团购价';
          activity.countName = '限时团购';
        } else if (activity.prom_type == 3) {
          //促销
          activity.countName = '优惠促销';
        } else if (activity.prom_type == 4) {
          //预售
          activity.priceName = '预售价';
          activity.countName = '预售商品';
        } else if (activity.prom_type == 8) {
          //砍价
          !this.isBragain ? activity.priceName = '砍价享' : activity.priceName = '';
          !this.isBragain ? activity.countName = '砍价活动' : activity.countName = '';
        }

        activity.countTime = '--天--时--分--秒';

        if (!activity.diffTime) {
          activity.diffTime = new Date().getTime() - activity.server_current_time * 1000;
        }
      } else if (activity.prom_type == 6) {
        activity.countName = '该商品正在参与拼团';
        activity.goods_id = activity.goods_id;
        activity.team_id = activity.prom_id ? activity.prom_id : 0;
        activity.item_id = activity.item_id ? activity.item_id : 0;
      }

      this.setData({
        'select.activity': activity
      });
      this.destroyActivityTimer();
      this.createActivityTimer();
      this.initSelectedData();
    },

    /** 初始化选中的（规格）商品的显示参数 */
    initSelectedData: function () {
      var goods = this.data.goods;
      var activity = this.select.activity;
      var specs = this.data.goods.spec_goods_price;
      var specSelect = this.specSelect;
      var stock = 0;
      var price = 0;

      if (activity.prom_type == 1 || activity.prom_type == 2) {
        price = activity.shop_price;
        stock = activity.store_count;
      } else if (activity.prom_type == 3) {
        price = activity.shop_price; // stock = specs.length > 0 ? specs[specSelect].store_count : goods.store_count;

        stock = activity.store_count;
      } else if (activity.prom_type == 4) {
        price = activity.shop_price; //stock = specs.length > 0 ? specs[specSelect].store_count : goods.store_count;

        stock = activity.store_count;
      } else if (activity.prom_type == 8 && !this.isBragain) {
        price = activity.end_price ? activity.end_price : activity.shop_price;
        stock = activity.store_count;
        this.setData({
          'select.bargain_price': price
        });
      } else if (specs.length > 0) {
        price = specs[specSelect].price;
        stock = specs[specSelect].store_count;
      } else {
        price = goods.shop_price;
        stock = goods.store_count;
      }

      price = parseInt(price).toFixed(2).toString().split('.');
      this.setData({
        'select.price': price,
        'select.stock': stock,
        'select.specName': specs.length > 0 ? specs[specSelect].key_name : ''
      });

      if (this.isBragain) {
        this.setData({
          isBragain: false
        });
      }
    },

    /** 检查是否倒计时是否结束 */
    checkActivityTime: function () {
      var that = this;
      var activity = that.select.activity;
      var remainTime = activity.end_time * 1000 - new Date().getTime() + activity.diffTime;

      if (remainTime > 0) {
        remainTime = util.remainTime(remainTime);
        that.setData({
          'select.activity.countTime': remainTime
        });
      } else {
        that.requestSpecInfo(that.specSelect);
        return;
      }
    },

    /** 创建活动倒计时定时器 */
    createActivityTimer: function () {
      var that = this;
      var activity = that.select.activity;

      if (!activity.prom_type || activity.prom_type == 6 || that.isBragain) {
        return;
      }

      that.timer = setInterval(function () {
        that.checkActivityTime();
      }, 1000);
    },

    /** 销毁活动倒计时定时器 */
    destroyActivityTimer: function () {
      if (this.timer) {
        clearInterval(this.timer);
        this.timer = null;
      }
    },

    /** 请求规格商品的活动信息 */
    requestSpecInfo: function (specSelect) {
      var that = this;
      var specs = that.data.goods.spec_goods_price;
      request.get('/api/goods/activity', {
        data: {
          goods_id: that.data.goods.goods_id,
          item_id: specs.length > 0 ? specs[specSelect].item_id : ''
        },
        success: function (res) {
          if (res.data.result.goods.activity_is_on == 1) {
            that.initActivity(res.data.result.goods);
          }
        }
      });
    },

    /** 减少购买的商品数量 */
    subCartNum: function (e) {
      this.checkCartNum(this.goodsInputNum - 1);
    },

    /** 增加购买的商品数量 */
    addCartNum: function (e) {
      this.checkCartNum(this.goodsInputNum + 1);
    },

    /** 输入购买的数量 */
    inputCartNum: function (e) {
      this.checkCartNum(Number(e.detail.value));
    },

    /** 检查购买的数量 */
    checkCartNum: function (num) {
      var specs = this.data.goods.spec_goods_price;
      var specSelect = this.specSelect;
      var activity = this.select.activity;
      var stock = this.data.goods.store_count; //参与活动

      if (activity && activity.activity_is_on == 1) {
        stock = activity.store_count;
      } else {
        if (specs.length > 0) {
          stock = specs[specSelect].store_count;
        }
      }

      if (num > stock || stock == 0) {
        num = stock;
      } else if (num < 1) {
        num = 1;
      }

      this.setData({
        goodsInputNum: num
      });
    },

    /** 加入购物车 */
    addCart: function (e) {
      var that = this;
      var itemId = 0;
      var specs = this.data.goods.spec_goods_price; //区分有规格和无规格

      if (specs.length > 0) {
        if (specs[this.specSelect].store_count <= 0) {
          return app.globalData.showTextWarining("当前无库存！");
        }

        itemId = specs[this.specSelect].item_id;
      } else {
        if (this.data.goods.store_count <= 0) {
          return app.globalData.showTextWarining("当前无库存！");
        }
      }

      if (this.goodsInputNum <= 0) {
        return app.globalData.showTextWarining("商品数量不能小于1");
      }

      var data = {
        goods_id: this.data.goods.goods_id,
        goods_num: this.goodsInputNum,
        item_id: itemId
      };

      if (this.data.goods.is_virtual) {
        return this.buyVirtualGoods(data);
      }

      if (e.currentTarget.dataset.action == 'add') {
        //加入购物车
        if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
          return;
        }

        request.post('/api/cart/add', {
          data: data,
          success: function (res) {
            that.setData({
              openSpecModal: false
            });
            request.checkUniqueId();
            app.globalData.showSuccess('添加成功');
          }
        });
      } else if (e.currentTarget.dataset.action == 'exchange') {
        //立即兑换
        this.exchange(data);
      } else if (e.currentTarget.dataset.action == 'reserve') {
        //立即预订
        this.reserve(data);
      } else {
        //立即购买
        this.buyNow(data);
      }
    },

    /** 商品筛选 */
    filterGoods: function (e) {
      this.resetData();
      this.requestGoodsList(e.currentTarget.dataset.href); // this.setData({ selecteds: this.data.selecteds })
      // this.closeFilterModal();
    },
    // 请求商品列表
    requestGoodsList: function (requestUrl) {
      var that = this;
      this.requestUrl = requestUrl;
      requestUrl += (requestUrl.indexOf('?') > 0 ? '&' : '?') + 'p=' + that.currentPage;
      load.request(requestUrl, function (res) {
        that.currentPage++;
        uni.stopPullDownRefresh();
      });
    },

    /** 砍价购买 */
    bargainBuy: function (e) {
      var that = this;

      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      var data = e.currentTarget.dataset;

      if (data.status) {
        //砍价拿
        that.setData({
          openSpecModal: false
        });
        var specs = that.data.goods.spec_goods_price;
        var specSelect = that.specSelect;
        var item_id = specs.length > 0 ? specs[specSelect]['item_id'] : '';

        if (that.select.stock == 0 || Number(that.select.stock) - Number(that.goodsInputNum) < 0) {
          that.setData({
            goodsInputNum: 1
          });
          return app.globalData.showTextWarining('砍价库存不足!');
        }

        uni.showModal({
          content: '确定发起砍价吗?',
          success: function (res) {
            if (res.confirm) {
              //去下单，并且发起砍价活动
              request.post('/api/Bargain/start_bargain', {
                data: {
                  bargain_id: that.select.activity.prom_id,
                  goods_num: that.goodsInputNum,
                  item_id: item_id
                },
                success: function (res) {
                  if (1 == res.data.status) {
                    uni.navigateTo({
                      url: '/pages/Bargain/bargain/bargain?id=' + res.data.result.id
                    });
                  } else {
                    app.globalData.showTextWarining(res.data.msg);
                  }
                }
              });
            }
          }
        });
      } else {
        //单独购
        that.addCart(e);
      }
    },

    /**-------------- 快速下单结束 --------------------*/
    //  筛选价格区间
    change: function (e) {
      var href = e.currentTarget.dataset.href;
      var flag1 = e.currentTarget.dataset.index1;
      this.setData({
        flag1: flag1,
        href: href
      });
    },
    //筛选头部
    change1: function (e) {
      var flag = e.currentTarget.dataset.index;
      this.setData({
        flag: flag
      });
    },
    // 重置
    reset: function () {
      this.setData({
        flag: 0,
        flag1: 40
      });
    }
  }
};
</script>
<style>
/* search.wxss */
.container {
    color: #666;
}
.container .nav{
    position:fixed;
    top:0;
    width:750rpx;
    z-index:1;
}
.filter-items{
    width: 100%;
}
.nav-item{
    float: left;
    width: 22.5%;
    height: 90rpx;
    line-height: 90rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28rpx;
    border-bottom: 1px solid #f3f3f3;
    background-color: #fff;
}
.nav-item .ico-dg{
    width: 18rpx;
    height: 12rpx;
    margin-left: 10rpx;
    line-height: 0;
}
.nav-item .ico-filter{
    width: 20rpx;
    height: 20rpx;
    margin-left: 10rpx;
    line-height: 0;
}
.ico-dir{
    width: 16rpx;
    height: 22rpx;
    margin-left: 10rpx;
    background-repeat: no-repeat;
    background-size: cover;
    background-position-x: 0;
}
.ico-dir-dn {
    background-position-x: -16rpx;
}
.ico-dir-up {
    background-position-x: -32rpx;
}
.nav-search{
    width: 10%
}
.nav-item .search-img{
    width: 30rpx;
    height: 30rpx;
}
.choice_list{
    background-color: #f5f5f5;
    margin-top:94rpx;
}
.choice_item{
    width: 710rpx;
    height: 220rpx;
    font-size: 28rpx;
    overflow: hidden;
    border-radius: 10rpx;
    margin:0rpx auto;
    margin-top: 20rpx;
    background: #fff;
}
.img-wrap{
    float: left;
    width: 220rpx;
    height: 220rpx;
    padding-right: 20rpx;
}
.img-wrap image{
    width: 100%;
    height: 100%;
}
.item-cont .title{
    padding-right: 10rpx;
    line-height: 42rpx;
    color: #333;
    margin-top: 15rpx;
    font-size: 28rpx;
    height: 82rpx;
    display: -webkit-box;
    word-break: break-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp:2;   
    overflow: hidden;
    text-overflow:ellipsis;
    width: 450rpx;
}
.price{
    display: inline-block;
    color: #ff6a00;
    font-size: 36rpx;
    font-weight: bold;
    margin-top:32rpx;
    float: left;
}
.item-cont{
  position: relative;
  width: 450rpx;
  float: left;
  height: 100%;
}
.comment{
    margin-top: 80rpx;
    font-size: 22rpx;
    color: #999;
}
/* 新的筛选页面 */
.filter-modal{
    position: fixed;
    left: 100rpx;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    background-color: white;
    overflow-x: hidden;
}
.filter-modal .title{
    height:88rpx;
    line-height:88rpx;
    background-color:#f5f5f5;
    font-size:36rpx;
    text-align:center;
    letter-spacing:4rpx;
    color:#333;
    font-family: MicrosoftYaHei;
}
.filter-modal .choose{
    padding:40rpx 0 20rpx 25rpx;
}
.filter-modal .choose>text{
	height: 48rpx;
    line-height: 48rpx;
	background-color: #ebebeb;
	border-radius: 24rpx;
	font-size: 24rpx;
	letter-spacing: 2rpx;
	color: #666666;
    display:inline-block;
    text-align: center;
    margin-left: 30rpx;
    margin-bottom:25rpx;
    padding:0 25rpx;
    border:2rpx solid #f3f3f3;
}
.filter-modal .choose .select{
    background-color: #ffe5e5;
	border: solid 2rpx #ff4c4c;
    color: #ff4c4c;
}
.filter-modal .money .choose text{
    letter-spacing: 0;
}
.filter-modal .money .choose view{
    position: relative;
}
.filter-modal .money .choose view text{
    position:absolute;
    margin-left:9rpx;
    color:#999;
}
.filter-modal .money .choose input{
    width: 180rpx;
    height: 48rpx;
    line-height: 48rpx;
	background-color: #f5f5f5;
	border-radius: 24rpx;
	font-size: 20rpx;
	letter-spacing: 2rpx;
    display:inline-block;
    text-align: center;
    margin-left: 30rpx;
    margin-bottom:25rpx;
    padding:0 25rpx;
}
/* .filter-modal .money .choose input:first-child{
    content: "-";
    display: inline-block;
    color: #ff6a00;
} */
.placeholder{
    color: #ccc;
}
.filter-modal .money .tit{
    padding-left:29rpx;
    margin-top:16rpx;
    font-size:30rpx;
    color:#333;
    font-weight:600;
    letter-spacing:3rpx;
}
.filter-modal .money .choose{
    padding-top: 30rpx;
}
.filter-modal .bac{
    height: 10rpx;
	background-color: #f5f5f5;
}
.filter-modal .bottom{
    height: 80rpx;
    line-height: 80rpx;
    text-align: center;
    font-size: 30rpx;
	letter-spacing: 3rpx;
	color: #666666;
    position:absolute;
    bottom:0;
    width:100%;
    background:#dbdbdb;
}
.filter-modal .bottom text{
    width: 50%;
    display:inline-block;
}
.filter-modal .bottom text:nth-child(2){
    background: #FF4C4C;
    color: #fefefe;
}
/* 旧的筛选页面 */
/* .filter-modal{
    position: fixed;
    left: 100rpx;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    background-color: white;
    overflow-x: hidden;
}
.filter-box{
    box-sizing: border-box;
    width: 100%;
    font-size: 28rpx;
    padding: 20rpx;
}
.filter-name{
    width: 100%;
    padding: 20rpx 0;
    word-break: keep-all;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 30rpx;
}
.filter-items{
    width: 100%;
}
.filter-item{
    float: left;
    width: fit-content;
    max-width: 500rpx;
    word-break: keep-all;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding: 10rpx;
    border-radius: 10rpx;
    border: 1rpx #ddd solid;
    margin: 0 10rpx 10rpx 0;
    background-color: #fdfdfd;
    color: #666;
}
.viewall-btn{
    margin-top: 20rpx;
    width: 300rpx;
} */
/* 搜索弹框 */
.search-modal{
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 20;
    background-color: white;
    overflow-x: hidden;
    font-size: 30rpx;
    color: #555555;
}
.search-bar{
    width: 100%;
    box-sizing: border-box;
    position: relative;
    margin-top: 14rpx;
    border-bottom:10rpx solid #f5f5f5;
    padding-bottom: 10rpx;
}
.search-input{
    width: 600rpx;
    height: 60rpx;
    float: left;
    /* border: 1rpx solid #e0e0e0; */
    box-sizing: border-box;
    padding-left:90rpx;
    border-top-left-radius:10rpx;
    border-bottom-left-radius: 10rpx;
    border-radius: 30rpx;
    font-size: 22rpx;
    margin-left: 20rpx;
    margin-right: 25rpx;
    background:#f5f5f5 !important;
}
input::-webkit-input-placeholder {
	color:999 !important;
}
.search-btn{
  width: 82rpx;
	height: 60rpx;
	background-color: #ff6a00;
	border-radius: 30rpx;
  font-size: 24rpx;
  color: #ffffff;
  margin: 0 20rpx;
}
.fdj {
  width: 36rpx;
  height: 36rpx;
  position: absolute;
  top: 14rpx;
  left: 50rpx;
}
.fdj image{
  width: 36rpx;
  height: 36rpx;
}
.search-btn .search-img{
  height: 45rpx;
  width: 45rpx;
  padding: 20rpx;
}
.search-hot{
    margin-top: 40rpx;
}
.hot-title{
    font-size: 30rpx;
    color: black;
    margin-bottom: 26rpx;
    padding-left:30rpx;
    font-weight: bold;
}
.hot-item{
    padding:10rpx 30rpx;
    font-size:24rpx;
    display: inline-block;
    border-radius: 25rpx;
    background-color: #f5f5f5;
    margin-left: 30rpx;
    margin-bottom:30rpx;
}
.h-label{
    position:absolute;
    font-size:16rpx;
    color:#ffffff;
    width:90rpx;
    height:25rpx;
    line-height:25rpx;
    padding-left:8rpx;
}

.historyList{
    padding:0 30rpx;
    margin-top:-20rpx;
}
.historyList view{
    width: 100%;
    color: #666666;
    font-size: 26rpx;
    height: 90rpx;
    line-height: 90rpx;
    border-bottom: 1rpx solid #f3f3f3;
}
.historyList .word{
    width: 600rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.historyList view .del{
    float:right;
    font-size:22rpx;
    border: 2rpx solid #f3f3f3;
    width: 84rpx;
    height:36rpx;
    line-height: 36rpx;
    color: #999;
    border-radius: 30rpx;
    text-align: center;
    margin-top:26rpx;
}
.text-center{
   position:absolute;
   bottom:13px;
   left:38%;
}
.clear{
    padding:10rpx 20rpx;
    border:1rpx solid #f3f3f3;
    border-radius:35rpx;
    color: #999999;
    font-size:20rpx;
}

/* 规格弹框 */
.spec-model{
    position: fixed;
    bottom: 0;
    background: white;
    width: 100%;
    padding: 0 30rpx;
    font-size: 32rpx;
    box-sizing: border-box;
    overflow-x: hidden;
    z-index:9999;
}

.spec-goods{
    padding: 15rpx 0 30rpx;
    float: left;
    width: 100%;
    border-bottom: 1px solid #f3f3f3;
}

.spec-goods-info{
    float: left;
    padding: 0 25rpx; 
    width: 490rpx;
}
.spec-goods-name{
    font-size: 30rpx;
    line-height: 35rpx;
    height: 70rpx;
    margin: 15rpx 20rpx 25rpx 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spec-goods-price{
    color: #ff6a00;
    font-size: 30rpx;
    font-weight: bold;
}
.spec-goods-stock{
    margin-top: 10rpx;
    font-size: 26rpx;
    color: #999999;
}
.spec-img{
    float: left;
    height: 180rpx;
    width: 180rpx;
    margin-top:16rpx;
}
.spec-goods-info{
    float: left;
    padding: 0 25rpx; 
    width: 430rpx;
}
.spec-goods-name{
    font-size: 30rpx;
    line-height: 35rpx;
    height: 70rpx;
    margin: 15rpx 20rpx 25rpx 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spec-goods-price{
    color: #ff6a00;
    font-size: 30rpx;
    font-weight: bold;
}
.spec-goods-stock{
    margin-top: 10rpx;
    font-size: 26rpx;
    color: #999999;
}
.spec-box{
  width: 100%;
  height: 50rpx;
  overflow: hidden;
  margin-top: 50rpx;
}
.spec-name{
    float: left;
    width: 150rpx;
    font-size: 32rpx;
}
.count{
    float: right;
    width: 184rpx;
    height: 50rpx;
    font-size: 32rpx;
    font-weight: bold;
}
.count>view,.count>input{
    float: left;
    width: 60rpx;
    height: 50rpx;
    line-height: 50rpx;
    text-align: center;
}
.spec-btn{
    color: black;
    background-color: #efefef;
    font-size: 24rpx;
    line-height: 48rpx;
    float: left;
    height: 48rpx;
    padding: 0 24rpx;
    border: 1rpx solid #f3f3f3;
    margin: 4rpx 20rpx 4rpx 0;
    border-radius: 24rpx;
    overflow: hidden;
}
.spec-btn-click{
    color: #ff3a3a;
    background-color: #ffefef;
    border: 1rpx solid #ff6a00;
}
.spec_types{
  width: 100%;
  height: auto;
  overflow: hidden;
  padding-top: 20rpx;
}
.spec-cart-btns{
    width: 100%;
    line-height: 68rpx;
    margin: 54rpx auto 32rpx;
    height: 68rpx;
}
.spec-cart-btn{
    float: left;
    width: 690rpx;
    height: 68rpx;
    font-size: 30rpx;
    text-align: center;
    color: white;
    border-radius: 10rpx;
}
.spec-buy{
    background-color: #ff6a00;
}
.spec-cart-btn-lg{
    width: 614rpx;
}
.spec-cart-disable{
    background-color: #ff6a00;
}
.spec-add-cart{
  display: none;
    background-color: #ffb03f;
}
.cover-layer{
    z-index:999;
}

.prom-info{
    margin: 10rpx 0;
    color: #ff6a00;
}
.prom-info>.prom-type{
    color: white;
    background-color: #ff6a00;
    margin-right: 14rpx;
    padding: 2rpx 8rpx;
    border-radius: 4rpx;
    font-size:26rpx;
}
.h-label{
  position: absolute;
  font-size: 16rpx;
  color: #ffffff;
  width: 90rpx;
  height: 25rpx;
  line-height: 25rpx;
  padding-left: 8rpx;
}


.choice_box {
    font-size: 12px;
}
.choice_box .choice_list .choice_item{
    width: 368rpx;
    float: left;
    margin: 2rpx;
    background-color: #fff;
}
.choice_box .choice_list image {
    width: 100%;
    height: 368rpx;
}
.choice_box .choice_list .title {
    height: 72rpx;
    line-height: 36rpx;
    font-weight: bold;
    text-align: center;
    color: #333;
}
.choice_box .choice_list .choice_footer {
    display: block; 
    margin: 20rpx 5rpx 15rpx;
    position: relative;
    height: 30rpx;
    line-height: 17rpx;
}
.choice_box .choice_list .choice_footer .price {
  color: #ff6a00;
  font-size:.855rem;
}
.choice_box .choice_list .choice_footer .similer {
    position: absolute;
    bottom: 0;
    right: 0;
    text-align: center;
    color: #686868;
    width: fit-content;
    line-height: 30rpx;
    padding: 1rpx 6rpx;
    border-radius: 5rpx;
     font-size:.655rem;
}
.smj{
    display:inline-block;
    min-width:5rpx;
    float:left;
    padding:0!important;
    color:#ff6a00;
    line-height:108rpx;
    height:70rpx;
    font-size:22rpx;
    font-weight: bold;
}
.click-go{
  border: 1rpx solid #ff6a00;
  font-size: 26rpx;
}

</style>